<template>
  <el-container style="min-height: 100vh">

    <el-aside :width="sideWidth+'px'" style="background-color: rgb(238, 241, 246);">
      <Aside :isCollapse="isCollapse"/>
    </el-aside>

    <el-container>

      <el-header style="border-bottom: 1px solid #ccc;">
        <Header :collapseBtnClass="collapseBtnClass" :collapse="collapse"/>
      </el-header>

      <el-main>
        <router-view />
      </el-main>

    </el-container>

  </el-container>
</template>

<script>

// import request from "@/utils/request";
import Aside from "@/components/Aside.vue";
import Header from "@/components/Header.vue";

export default {
  name: 'HomeView',
  data(){
    return{
      collapseBtnClass: "el-icon-s-fold",
      isCollapse: false,
      sideWidth: 200,
      userData: localStorage.getItem("user") ? JSON.parse(localStorage.getItem("user")) : {},
      Authorities: localStorage.getItem("authorities") ? JSON.parse(localStorage.getItem("authorities")) : {}
    }
  },
  components: {
    Aside,
    Header
  },
  created() {
    console.log(this.userData);
    console.log(this.Authorities);
  },
  methods:{
    collapse(){
      this.isCollapse^=1;
      if(this.isCollapse) {
        this.sideWidth = 64;
        this.collapseBtnClass = 'el-icon-s-unfold';
      } else {
        this.sideWidth = 200;
        this.collapseBtnClass = 'el-icon-s-fold';
      }
    }
  }
}
</script>

